package com.lxw.weather.model;

import android.os.Parcel;
import android.os.Parcelable;

public class HourlyForecast implements Parcelable {
    private String hour;
    private String temp;
    private String weatherCondition;
    private String weatherIcon;
    private String windDirection; // 新增：风向
    private String windPower;    // 新增：风力
    private String minTemp;      // 新增：最低温度
    private String maxTemp;      // 新增：最高温度
    private boolean isDayTime;   // 新增：是否白天

    public HourlyForecast() {
    }

    // 带所有参数的构造函数
    public HourlyForecast(String hour, String temp, String weatherCondition, String weatherIcon,
                          String windDirection, String windPower, String minTemp, String maxTemp, boolean isDayTime) {
        this.hour = hour;
        this.temp = temp;
        this.weatherCondition = weatherCondition;
        this.weatherIcon = weatherIcon;
        this.windDirection = windDirection;
        this.windPower = windPower;
        this.minTemp = minTemp;
        this.maxTemp = maxTemp;
        this.isDayTime = isDayTime;
    }

    // Getters and setters
    public String getHour() {
        return hour;
    }

    public void setHour(String hour) {
        this.hour = hour;
    }

    public String getTemp() {
        return temp;
    }

    public void setTemp(String temp) {
        this.temp = temp;
    }

    public String getWeatherCondition() {
        return weatherCondition;
    }

    public void setWeatherCondition(String weatherCondition) {
        this.weatherCondition = weatherCondition;
    }

    public String getWeatherIcon() {
        return weatherIcon;
    }

    public void setWeatherIcon(String weatherIcon) {
        this.weatherIcon = weatherIcon;
    }

    public String getWindDirection() {
        return windDirection;
    }

    public void setWindDirection(String windDirection) {
        this.windDirection = windDirection;
    }

    public String getWindPower() {
        return windPower;
    }

    public void setWindPower(String windPower) {
        this.windPower = windPower;
    }

    public String getMinTemp() {
        return minTemp;
    }

    public void setMinTemp(String minTemp) {
        this.minTemp = minTemp;
    }

    public String getMaxTemp() {
        return maxTemp;
    }

    public void setMaxTemp(String maxTemp) {
        this.maxTemp = maxTemp;
    }

    public boolean isDayTime() {
        return isDayTime;
    }

    public void setDayTime(boolean dayTime) {
        isDayTime = dayTime;
    }

    // Parcelable implementation
    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.hour);
        dest.writeString(this.temp);
        dest.writeString(this.weatherCondition);
        dest.writeString(this.weatherIcon);
        dest.writeString(this.windDirection);
        dest.writeString(this.windPower);
        dest.writeString(this.minTemp);
        dest.writeString(this.maxTemp);
        dest.writeByte((byte) (this.isDayTime ? 1 : 0));
    }

    protected HourlyForecast(Parcel in) {
        this.hour = in.readString();
        this.temp = in.readString();
        this.weatherCondition = in.readString();
        this.weatherIcon = in.readString();
        this.windDirection = in.readString();
        this.windPower = in.readString();
        this.minTemp = in.readString();
        this.maxTemp = in.readString();
        this.isDayTime = in.readByte() != 0;
    }

    public static final Creator<HourlyForecast> CREATOR = new Creator<HourlyForecast>() {
        @Override
        public HourlyForecast createFromParcel(Parcel source) {
            return new HourlyForecast(source);
        }

        @Override
        public HourlyForecast[] newArray(int size) {
            return new HourlyForecast[size];
        }
    };
}